import { POST_APP_DATA, CHANGE_FIELD_DATA } from '../../constants/ActionType';
import { fetchPOST } from '../../utils/index';

const initialState = {
    showCaseData: {}
}

export default function uploadData(state = initialState, action) {
    const { type, payload } = action;
    const { showCaseData } = state; 
    switch (type) {
        case POST_APP_DATA:
            return state;
        case CHANGE_FIELD_DATA:
            changeFieldData(state, payload);
            return { ...state, showCaseData };
        default:
            return state;
    }
}

function changeFieldData(state, payload){
    const { showCaseData } = state;
    console.log('state', state);
    showCaseData[payload.fieldName] = payload.fieldValue;
}